# 操作exec文件
import xlrd
# 打开文件
xlsx = xlrd.open_workbook("123.xlsx")
# 获得指定的标签页
table = xlsx.sheet_by_index(0)
# 获得多少行
rows = table.nrows
count = 0
sum = 0

for i in range(1, rows):
    # 获得班级
    classId = table.cell_value(i, 1)
    if classId == 3:
        count += 1
        sum += table.cell_value(i, 2)

print(f"平均分为：{sum / count}")

